home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / Extras / DLGoodies / gunzip.dopus5 < prev    next >
Text File  |  1996-08-29  |  2KB  |  72 lines

  1. /*
  2.  *  A 'quick and dirty' script to gunzip archives from DirectoryOpus using
  3.  *  drag & drop (similar to LHA-archives).
  4.  *
  5.  *  V1.0 (20.7.96) by David Lübbren.
  6.  *
  7.  *  The source file should have the following format :
  8.  *        <file>.tar.gz   or   <file>.tgz
  9.  *
  10.  *  Installation:
  11.  *    (Note: exact names may differ as I run the german DOpus version)
  12.  *
  13.  *    Add a GZIP file type in the file type editor with the following:
  14.  *      Compare Name  #?.(gz|tgz)
  15.  *
  16.  *    Actions:
  17.  *      Drag&Drop     Arexx     DOpus5:Arexx/gunzip.dopus5 {Qp} {f} {d}
  18.  *      Attr.         With all files
  19.  *                    Rescan destination
  20.  *      DoubleClick   AmigaDOS  gzip -l {f}
  21.  *      Attr.         Output in text viewer
  22.  *
  23.  *  Optional:
  24.  *    Add a TAR file type in the file type editor:
  25.  *      Compare Name #?.tar
  26.  *
  27.  *    Action:
  28.  *      DoubleClick   AmigaDOS  tar xf {o}
  29.  *      Attr.         CD source
  30.  *                    Rescan source
  31.  *
  32.  *
  33.  *  TODO:
  34.  *    Use more rigorous file identification. I don't know the internal
  35.  *    format of gzip files (apparently some kind of CRC-check).
  36.  *
  37.  */
  38.  
  39. OPTIONS RESULTS
  40.  
  41. PARSE ARG dopusport file dest .
  42. IF dopusport ~= "" THEN ADDRESS VALUE dopusport
  43. ELSE DO
  44.   SAY "No DOpus running !"
  45.   EXIT
  46. END
  47.  
  48. file = STRIP(file, 'B', '"')
  49. dest = STRIP(dest, 'B', '"')
  50.  
  51. divpos = MAX(LASTPOS(':', file), LASTPOS('/', file)) + 1
  52. filename = SUBSTR(file, divpos)
  53. lp = LASTPOS('.', filename)
  54. IF lp ~= 0 THEN DO
  55.   unarch = dest || SUBSTR(filename, 1, lp - 1)
  56.   /*
  57.    * Hack to process '.tgz' archives.
  58.    */
  59.   IF RIGHT(unarch, 4) ~= ".tar" THEN DO
  60.     unarch = unarch || ".tar"
  61.   END
  62.   ADDRESS COMMAND 'gunzip -c 'file' > 'unarch
  63. END
  64. ELSE DO
  65.   dopus request '"Archive Name 'filename' not of required type" Ok'
  66.   EXIT 5
  67. END
  68.  
  69. EXIT
  70.  
  71.  
  72.